/*
 * @Author: 别拿暗恋当饭吃. 13466071+lililkli@user.noreply.gitee.com
 * @Date: 2024-06-26 16:35:37
 * @LastEditors: 别拿暗恋当饭吃. 13466071+lililkli@user.noreply.gitee.com
 * @LastEditTime: 2024-06-26 21:23:17
 * @FilePath: \rabce\project\src\store\text\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {createSlice,createAsyncThunk} from '@reduxjs/toolkit'
import * as services from 'services/text'
import { addBuilder } from 'store/dict'
export const dogetext =  createAsyncThunk<any>(
    "text/dogetext",
    async()=>{
        const res = services.textlist()
        console.log("text结果",res);
        
        return res
    }
)
const initialState = {
    text:{}
}
const Text = createSlice({
    name:'text',
    initialState,
    reducers:{},
    extraReducers:(buildr)=>{
        addBuilder(buildr,dogetext,(state,action)=>{
            const {result} = action.payload
            console.log("text数据",result);
            
            state.text = result
        })
    }
})
export default Text.reducer

export const dogetextselece = (state:any)=>{
    return state.text.text
}